在集群节点上配置和运行内置平衡器

仅适用于与KATA 5.0 或更高版本的多个服务器集成时。

要在集群节点上配置内置平衡器:

  1. 在集群节点上启动操作系统命令 shell,以使用超级用户(系统管理员)权限运行命令。
  2. 使用以下命令重命名平衡器的基本配置文件:

    mv /etc/haproxy/haproxy.cfg /etc/haproxy/haproxy.cfg.orig

  3. 之前准备好的配置 haproxy.cfg 配置文件放在/etc/haproxy目录下,使用以下命令为其设置访问权限:

    chown root:root /etc/haproxy/haproxy.cfg

    chmod 640 /etc/haproxy/haproxy.cfg

  4. 创建含以下内容的 /etc/snmp/snmptrapd.conf 配置文件:

    $ModLoad imudp

    $UDPServerRun 514

    $UDPServerAddress 127.0.0.1

    if $syslogfacility-text == 'local6' then /var/log/haproxy.log

    if $syslogfacility-text == 'local6' then stop

    if $programname startswith 'haproxy' then /var/log/haproxy.log

    if $programname startswith 'haproxy' then stop

  5. 使用以下命令创建 /var/log/haproxy.log 文件并为其设置访问权限:

    touch /var/log/haproxy.log

    chown root:adm /var/log/haproxy.log

    chmod 640 /var/log/haproxy.log

  6. 如有必要,编辑内置平衡器的日志轮换设置文件 (/etc/logrotate.d/haproxy)。

    默认情况下,条目每天轮换。

  7. 重启系统日志服务:

    systemctl restart rsyslog

  8. 启动内置平衡器服务:

    systemctl start haproxy

  9. 允许自动运行内置平衡器服务:

    systemctl enable haproxy

  10. 检查内置平衡器服务的状态:

    systemctl status haproxy

    状态必须是running

  11. 检查内置平衡器日志中是否存在条目:

    tail /var/log/haproxy.log

内置平衡器在 KSMG 集群节点上配置并启动。

页面顶部